<?php

require_once DOC_ROOT . '/src/smarty/Smarty.class.php';

class PSmarty {

    static $smarty;

    public function __construct() {
        self::$smarty = new Smarty();
        $this->_init();
    }

    private function _init() {
        // 设定缓存目录、模板目录
        self::$smarty->setTemplateDir(DOC_ROOT . '/src/view/tpl');
        self::$smarty->setCompileDir(DOC_ROOT . '/src/caches/tpl_cache');
        self::$smarty->setConfigDir(DOC_ROOT . '/src/caches/tpl_cache');
        self::$smarty->setCacheDir(DOC_ROOT . '/src/caches/tpl_cache');
    }

    public static function getSmarty() {
        return self::$smarty;
    }

}

new PSmarty();